﻿<!--
    
/* ****************************************************************************
 *
 * Copyright (c) Microsoft Corporation. 
 *
 * This source code is subject to terms and conditions of the Microsoft Public License. A
 * copy of the license can be found at http://go.microsoft.com/fwlink/?LinkID=131993. If
 * you cannot locate the Microsoft Public License, please send an email to
 * mixon@microsoft.com. By using this source code in any fashion, you are agreeing to
 * be bound by the terms of the Microsoft Public License.
 *
 * You must not remove this notice, or any other, from this software.
 *
 *
 * ***************************************************************************/
    
-->
<UserControl x:Class="MIXOnline.Descry.AttachableMultiScaleImage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:tribe="clr-namespace:MIXOnline.Descry"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    >
	<UserControl.Resources>
		<ControlTemplate x:Key="ToggleButtonShowMarkersTemplate" TargetType="ToggleButton">
			<Grid>
				<vsm:VisualStateManager.VisualStateGroups>
					<vsm:VisualStateGroup x:Name="CommonStates">
						<vsm:VisualState x:Name="Normal"/>
						<vsm:VisualState x:Name="MouseOver"/>
						<vsm:VisualState x:Name="Pressed">
							<Storyboard>
								<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Visibility)">
									<DiscreteObjectKeyFrame KeyTime="00:00:00">
										<DiscreteObjectKeyFrame.Value>
											<Visibility>Visible</Visibility>
										</DiscreteObjectKeyFrame.Value>
									</DiscreteObjectKeyFrame>
								</ObjectAnimationUsingKeyFrames>
								<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image1" Storyboard.TargetProperty="(UIElement.Visibility)">
									<DiscreteObjectKeyFrame KeyTime="00:00:00">
										<DiscreteObjectKeyFrame.Value>
											<Visibility>Collapsed</Visibility>
										</DiscreteObjectKeyFrame.Value>
									</DiscreteObjectKeyFrame>
								</ObjectAnimationUsingKeyFrames>
							</Storyboard>
						</vsm:VisualState>
						<vsm:VisualState x:Name="Disabled"/>
					</vsm:VisualStateGroup>
					<vsm:VisualStateGroup x:Name="CheckStates">
						<vsm:VisualState x:Name="Indeterminate"/>
						<vsm:VisualState x:Name="Checked">
							<Storyboard>
								<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image1" Storyboard.TargetProperty="(UIElement.Visibility)">
									<DiscreteObjectKeyFrame KeyTime="00:00:00">
										<DiscreteObjectKeyFrame.Value>
											<Visibility>Collapsed</Visibility>
										</DiscreteObjectKeyFrame.Value>
									</DiscreteObjectKeyFrame>
								</ObjectAnimationUsingKeyFrames>
								<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Visibility)">
									<DiscreteObjectKeyFrame KeyTime="00:00:00">
										<DiscreteObjectKeyFrame.Value>
											<Visibility>Visible</Visibility>
										</DiscreteObjectKeyFrame.Value>
									</DiscreteObjectKeyFrame>
								</ObjectAnimationUsingKeyFrames>
							</Storyboard>
						</vsm:VisualState>
						<vsm:VisualState x:Name="Unchecked"/>
					</vsm:VisualStateGroup>
					<vsm:VisualStateGroup x:Name="FocusStates">
						<vsm:VisualState x:Name="Unfocused"/>
						<vsm:VisualState x:Name="Focused"/>
					</vsm:VisualStateGroup>
				</vsm:VisualStateManager.VisualStateGroups>
				<Image Source="../Images/menu_pins_off.png" Stretch="Fill" x:Name="image1"/>
				<Image Source="../Images/menu_pins_on.png" Stretch="Fill" Visibility="Collapsed" x:Name="image"/>
			</Grid>
		</ControlTemplate>
		<Style x:Key="SliderOpacityThumbTemplate" TargetType="Thumb">
			<Setter Property="Background" Value="#FF1F3B53"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="IsTabStop" Value="False"/>
			<Setter Property="BorderBrush">
				<Setter.Value>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FFA3AEB9" Offset="0"/>
						<GradientStop Color="#FF8399A9" Offset="0.375"/>
						<GradientStop Color="#FF718597" Offset="0.375"/>
						<GradientStop Color="#FF617584" Offset="1"/>
					</LinearGradientBrush>
				</Setter.Value>
			</Setter>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="Thumb">
						<Grid>
							<vsm:VisualStateManager.VisualStateGroups>
								<vsm:VisualStateGroup x:Name="CommonStates">
									<vsm:VisualState x:Name="Normal"/>
									<vsm:VisualState x:Name="MouseOver">
										<Storyboard/>
									</vsm:VisualState>
									<vsm:VisualState x:Name="Pressed">
										<Storyboard/>
									</vsm:VisualState>
									<vsm:VisualState x:Name="Disabled">
										<Storyboard/>
									</vsm:VisualState>
								</vsm:VisualStateGroup>
								<vsm:VisualStateGroup x:Name="FocusStates">
									<vsm:VisualState x:Name="Focused">
										<Storyboard/>
									</vsm:VisualState>
									<vsm:VisualState x:Name="Unfocused"/>
								</vsm:VisualStateGroup>
							</vsm:VisualStateManager.VisualStateGroups>
							<Ellipse Margin="0,3.706,0,3.294" Stroke="{x:Null}">
								<Ellipse.Fill>
									<LinearGradientBrush EndPoint="0.562,0.98" StartPoint="0.562,-0.02">
										<GradientStop Color="#FFFFFFFF"/>
										<GradientStop Color="#C6A8A8A8" Offset="0.995"/>
									</LinearGradientBrush>
								</Ellipse.Fill>
							</Ellipse>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="SliderOpacityTemplate" TargetType="Slider">
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Maximum" Value="10"/>
			<Setter Property="Minimum" Value="0"/>
			<Setter Property="Value" Value="0"/>
			<Setter Property="BorderBrush">
				<Setter.Value>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FFA3AEB9" Offset="0"/>
						<GradientStop Color="#FF8399A9" Offset="0.375"/>
						<GradientStop Color="#FF718597" Offset="0.375"/>
						<GradientStop Color="#FF617584" Offset="1"/>
					</LinearGradientBrush>
				</Setter.Value>
			</Setter>
			<Setter Property="IsTabStop" Value="False"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="Slider">
						<Grid x:Name="Root">
							<Grid.Resources>
								<ControlTemplate x:Key="RepeatButtonTemplate">
									<Grid x:Name="Root" Opacity="0" Background="Transparent"/>
								</ControlTemplate>
							</Grid.Resources>
							<vsm:VisualStateManager.VisualStateGroups>
								<vsm:VisualStateGroup x:Name="CommonStates">
									<vsm:VisualState x:Name="Normal"/>
									<vsm:VisualState x:Name="MouseOver"/>
									<vsm:VisualState x:Name="Disabled">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="HorizontalTrackRectangleDisabledOverlay" Storyboard.TargetProperty="Visibility">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ThumbDisabledOverlay" Storyboard.TargetProperty="Visibility">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="VerticalTrackRectangleDisabledOverlay" Storyboard.TargetProperty="Visibility">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</vsm:VisualState>
								</vsm:VisualStateGroup>
							</vsm:VisualStateManager.VisualStateGroups>
							<Rectangle Margin="0,0,0,0" Stroke="{x:Null}" StrokeThickness="1" RadiusX="16" RadiusY="16" Fill="#FF000000" Height="25" Width="25" Opacity="0.25"/>
							<Grid x:Name="HorizontalTemplate" Background="{TemplateBinding Background}">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="Auto"/>
									<ColumnDefinition Width="Auto"/>
									<ColumnDefinition Width="*"/>
								</Grid.ColumnDefinitions>
								<Rectangle Height="3" Margin="5,0,5,0" x:Name="TrackRectangle" Opacity="0.6" Grid.Column="0" Grid.ColumnSpan="3" Fill="#FF424242" Stroke="{x:Null}" StrokeThickness="{TemplateBinding BorderThickness}" RadiusX="1" RadiusY="1"/>
								<Rectangle Height="3" Margin="5,0,5,0" x:Name="HorizontalTrackRectangleDisabledOverlay" Opacity=".55" Visibility="Collapsed" Grid.Column="0" Grid.ColumnSpan="3" Fill="White" RadiusX="1" RadiusY="1"/>
								<RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Column="0"/>
								<Thumb Height="18" Margin="0.216,5,-0.216,5" x:Name="HorizontalThumb" Style="{StaticResource SliderOpacityThumbTemplate}" Width="11" Opacity="0.65" Background="#FF393939" BorderBrush="{x:Null}" Foreground="{x:Null}" IsTabStop="True" Grid.Column="1"/>
								<Rectangle x:Name="ThumbDisabledOverlay" Width="11" Opacity=".55" Visibility="Collapsed" Grid.Column="1" Fill="White" RadiusX="2" RadiusY="2"/>
								<RepeatButton Margin="0.216,0,-0.216,0" x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Background="#FF515151" BorderBrush="{x:Null}" Foreground="{x:Null}" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Column="2"/>
							</Grid>
							<Grid x:Name="VerticalTemplate" Visibility="Collapsed" Background="{TemplateBinding Background}">
								<Grid.RowDefinitions>
									<RowDefinition Height="*"/>
									<RowDefinition Height="Auto"/>
									<RowDefinition Height="Auto"/>
								</Grid.RowDefinitions>
								<Rectangle Margin="0,5,0,5" Width="3" Grid.Row="0" Grid.RowSpan="3" Fill="#FFE6EFF7" Stroke="#FFA3AEB9" StrokeThickness="{TemplateBinding BorderThickness}" RadiusX="1" RadiusY="1"/>
								<Rectangle Margin="0,5,0,5" x:Name="VerticalTrackRectangleDisabledOverlay" Width="3" Opacity=".55" Visibility="Collapsed" Grid.Row="0" Grid.RowSpan="3" Fill="White" RadiusX="1" RadiusY="1"/>
								<RepeatButton x:Name="VerticalTrackLargeChangeDecreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Row="2"/>
								<Thumb Height="11" x:Name="VerticalThumb" Width="18" IsTabStop="True" Grid.Row="1"/>
								<RepeatButton x:Name="VerticalTrackLargeChangeIncreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Row="0"/>
							</Grid>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</UserControl.Resources>
    <Grid x:Name="LayoutRoot">

        <Grid.Background>
            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
                <GradientStop Color="#333333" Offset="0.0"/>
                <GradientStop Color="#191919" Offset="1.0"/>
            </LinearGradientBrush>
        </Grid.Background>

        <MultiScaleImage x:Name="ZoomImage" 
                         ImageOpenSucceeded="ZoomImage_ImageOpenSucceeded" 
                         MouseLeftButtonDown="ZoomImage_MouseLeftButtonDown"
                         MouseLeftButtonUp="ZoomImage_MouseLeftButtonUp" 
                         MouseMove="ZoomImage_MouseMove"/>

        <Canvas x:Name="canvasOpacity" Background="#000000" Opacity="0.0" IsHitTestVisible="False"/>
        
        <Image  x:Name="imageBanner" Width="92" Height="92" Source="../images/menu_sash_up.png" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="Hand" ToolTipService.ToolTip="Click to sign up!" MouseEnter="imageBanner_MouseEnter" MouseLeave="imageBanner_MouseLeave" MouseLeftButtonDown="imageBanner_MouseLeftButtonDown"/>
        
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,5,5,0">
            <Slider Margin="0,0,5,0" x:Name="sliderOpacity" Minimum="0.0" Maximum="1.0" Value="0.0" Width="28" ValueChanged="Slider_ValueChanged" Style="{StaticResource SliderOpacityTemplate}">
            	
            </Slider>
            <Image Margin="0,0,5,0" x:Name="imageHome" ToolTipService.ToolTip="Center Image" Width="28" Height="28" Source="../images/menu_home_up.png" MouseLeftButtonDown="imageHome_MouseLeftButtonDown" MouseEnter="imageHome_MouseEnter" MouseLeave="imageHome_MouseLeave"/>
            <Image Margin="0,0,5,0" x:Name="imageZoomIn" Width="28" ToolTipService.ToolTip="Zoom In" Height="28" Source="../images/menu_+_up.png" MouseLeftButtonDown="imageZoomIn_MouseLeftButtonDown" MouseEnter="imageZoomIn_MouseEnter" MouseLeave="imageZoomIn_MouseLeave"/>
            <Image Margin="0,0,5,0" x:Name="imageZoomOut" ToolTipService.ToolTip="Zoom Out" Width="28" Height="28" Source="../images/menu_-_up.png" MouseLeftButtonDown="imageZoomOut_MouseLeftButtonDown" MouseEnter="imageZoomOut_MouseEnter" MouseLeave="imageZoomOut_MouseLeave"/>
            <Image Margin="0,0,5,0" x:Name="imageHelp" ToolTipService.ToolTip="Need Help?" Width="28" Height="28" Source="../images/menu_help_up.png" MouseLeftButtonDown="imageHelp_MouseLeftButtonDown" MouseEnter="imageHelp_MouseEnter" MouseLeave="imageHelp_MouseLeave"/>
            <ToggleButton x:Name="toggleButtonShowMarkers" Content="Hide Markers" Click="toggleButtonShowMarkers_Click" Width="28" Height="28" Template="{StaticResource ToggleButtonShowMarkersTemplate}"  />
        </StackPanel>

        <Canvas x:Name="canvasPinnedObjects" d:IsHidden="True"/>
        
        <Canvas d:IsHidden="True">
            <tribe:CharacterMarker x:Name="characterMarker" Visibility="Collapsed"/>
            <tribe:PopMarker x:Name="popMarker" Visibility="Collapsed"/>
            <tribe:ProcessMarker x:Name="processMarker" Visibility="Collapsed"/>
        </Canvas>

    </Grid>
</UserControl>
